<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>flightSaleDetail.html 航线销售详情</title>
	</head>
	<link rel="stylesheet" href="../css/common.css" />
	<link rel="stylesheet" href="../css/less/common_less.css" />
	<link rel="stylesheet" href="../css/flightSaleDetail.css" />
	<style>
		
		input{
			font-family:"微软雅黑";
		}
		
		.Dolo_btn{
			    width: 90px;
   			    height: 28px;
   				border: none;
   				cursor: pointer;
   			    background: url(../img/flightManage/chaxun.jpg) no-repeat;
   			    background-size: cover;
   			    
		}
	
		.color_font{
			font-size:14px;
		}
		.font12px{
		font-size:12px;
		}
		.font_weight{
		font-weight:bold;
		}
		.tabData{
			margin-top:10px;
			margin-left:10px;
		}
		.tabHead th{
			height:30px;
		}
		.tabData table td,.tabData table th{
			border:0;
		}
		.tabData table .tabHead{
			border-bottom:5px solid #f1f1f1;
		}
		.tab_clear tr{
			border-bottom:5px solid #f1f1f1;
		}
        #link {
           
            cursor: pointer;

        }
        #link:hover{
            text-decoration: underline;
        }
	</style>
	<body>	
		<p class='head'>
			<span class="head_setting" ><span class="f868686">航班编号：</span><span class='airlineCode f262929' ></span></span>
			<span class="head_setting" ><span class="f868686">出发日期:</span><span class='departureDate f262929' ></span></span>
			<span class="head_setting" ><span class="f868686">出发机场:</span><span class='depCn f262929' ></span></span>
			<span class="head_setting" ><span class="f868686">到达机场:</span><span class='arrCn f262929' ></span></span>				
		</p>
		<div class='tabData'>
			<table>
				<tr class='tabHead f868686'>
					<th>航段</th>
					<th>订单编号</th>
					<th>采购商/创建人</th>
					<th>订单状态</th>
					<th>销售类型</th>
					<th>预计座位数</th>
					<th>实际座位数</th>
				</tr>
				<tbody class='tab_clear'>
					
				</tbody>									
			</table>
		</div>
		
		
		<script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>
		<script type="text/javascript" src="../layer-v2.4/layer/layer.js" ></script>
		<script type="text/javascript" src="../js/common.js" ></script>
		<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>
		
	</body>
	<script>
	var airlineCode = getHref().airlineCode;//航班号
	var departureDate = getHref().departureDate;//出发日期
	var depCn = getHref().depCn;//出发机场名称
	var dep = getHref().dep;//出发三字码
	var arrCn = getHref().arrCn;//到达机场名称
	var arr = getHref().arr;//到达三字码
	$(".airlineCode").text(airlineCode);
	$(".departureDate").text(departureDate);
	$(".depCn").text(depCn+"("+dep+")");
	$(".arrCn").text(arrCn+"("+arr+")");
	/*-------------------ajax请求加载表格数据--------------------------------*/

	$.ajax({
		type:"get",
		url:"../statistics/segDetail?airlineCode="+airlineCode+"&departureDate="+departureDate+"&dep="+dep+"&arr="+arr+"&temp="+Math.random(),
		//url:'../JSON/flightSalelistDetail.json',
		dataType:"json",
		async:true,
		success:function(data){
			//data = JSON.parse(data)
			//console.log(data)
			$(".tab_clear").empty();
			var str="";
			for(var i=0;i<data.data.length;i++){
				var minNum=Math.ceil(parseInt(data.data[i].passengerTotal)*parseFloat(data.data[i].ticketRate)/100);
				str+="<tr>"+
					"<td class='color_font f262929'>"+dep+"—"+arr+"</td>"+
					"<td id='link' class='faa000'>"+data.data[i].id+"</td>"+
					"<td class='color_font f00aa99'>"+commomFun.toEmptyString(data.data[i].purchaseName)+"<br><span class='font12px f60666'>"+data.data[i].createUserName+"</span></td>"+
					"<td class='orderStatus color_font'>"+commomFun.orderTypeStr(data.data[i].status)+"</td>"+
					"<td class='color_font f262929'>"+commomFun.orderSaleStatusStr(data.data[i].type)+"</td>"+
					"<td><span class='f60666'>订单座位数:&nbsp;&nbsp;</span><span class='font_weight f00aa99'>"+data.data[i].passengerTotal+"</span><br/>"
					if(data.data[i].ticketRate){
						str+="<span class='f60666'>最小座位数:&nbsp;&nbsp;</span><span class='font_weight f00aa99'>"+minNum+"</span>"
					}else{
						str+="<span class='f60666'>最小座位数:&nbsp;&nbsp;</span><span class='font_weight f00aa99'>"+data.data[i].passengerTotal+"</span>"
					}
						
				str+="</td>"+
					"<td><span class='f60666'>"+commomFun.orderTypeStr(data.data[i].status)+
					"座位数:&nbsp;&nbsp;</span><span class='font_weight f00aa99'>"+data.data[i].realPassengerTotal+"</span>"+
					"</td>"+
					"</tr>"	

			}
			
			$(".tab_clear").append(str);
			/*控制不同的状态，字体颜色不同begin*/
			for(var i=0;i<$(".tab_clear>tr").length;i++){
				if($(".orderStatus").eq(i).text()=="待支付"||$(".orderStatus").eq(i).text()=="待出票"){
					$(".orderStatus").eq(i).addClass("fa2828");
				}else if($(".orderStatus").eq(i).text()=="已支付"||$(".orderStatus").eq(i).text()=="已出票"){
					$(".orderStatus").eq(i).addClass("f00aa99");
				}else{
					$(".orderStatus").eq(i).addClass("aaaaaa");
				}
			}
			/*控制不同的状态，字体颜色不同end*/
		}
	});
        $("table").delegate("#link","click",function(){
            var id = $(this).text();
            parent.layer.open({
                type: 2,
                title: false,
                shadeClose: true,
                closeBtn: 0,
                shade: [0.9,'#cfcfcf'],
                area: ['98%', '98%'],
                content: ['../ak/embedDiv.html?id='+id],// iframe的url，no代表不显示滚动条
                end:function(){

                }

            })
        })
	</script>
</html>
